package lab02.test23;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Test23 {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        DateFormat dateFormat1 = new SimpleDateFormat("E");


        System.out.println("请输入今年生日：");
        Date date = dateFormat.parse(sc.nextLine());


        Calendar cal = Calendar.getInstance();
        Date date1 =dateFormat.parse(dateFormat.format(cal.getTime()));


        long day = (date.getTime() - date1.getTime()) / (24 * 60 * 60 * 1000);
        if (day > 0) {
            System.out.println("距离你生日还有" + day  );
            System.out.println("生日是：" + dateFormat1.format(date));

        } else {
            System.out.print("你的生日已经过了");
        }

    }
}
